From 4d760cae090ffb2f06301aff92229aaa4d0010f1 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Mon, 27 Apr 2026 22:53:59 +0200 Subject: [PATCH] messageTray: Don't try to focus destroyed actor When `ungrabFocus()` is called after hiding a notification, the previous focus actor might have already been destroyed and trying to focus it will trigger a gjs error. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/work_items/9190 Part-of: --- js/ui/messageTray.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index e593d0da7..7f3923380 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -88,6 +88,10 @@ class FocusGrabber { this._prevKeyFocusActor = global.stage.get_key_focus(); + this._prevKeyFocusActor?.connectObject('destroy', () => { + this._prevKeyFocusActor = null; + }, this); + global.stage.connectObject('notify::key-focus', this._focusActorChanged.bind(this), this); @@ -101,6 +105,8 @@ class FocusGrabber { if (!this._focused) return false; + this._prevKeyFocusActor?.disconnectObject(this); + global.stage.disconnectObject(this); this._focused = false; -- 2.39.5